import java.util.ArrayList;
import java.util.Collections;


class Student implements Comparable<Student>{
    private String name;
    private int age;
    private double score;

    public Student(String name, int age, double score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }

    @Override
    public int compareTo(Student o) {
       return (int)(this.score - o.score);
    }
}
public class Test {
    public static void main(String[] args) {
        ArrayList<Student> arrayList = new ArrayList<>();
        arrayList.add(new Student("one",10,99.0));
        arrayList.add(new Student("two",20,96.5));
        arrayList.add(new Student("three",22,98.0));
        for (Student s:arrayList) {
            System.out.println(s);
        }
        System.out.println("==============================================");
        Collections.sort(arrayList);
        for (Student s:arrayList) {
            System.out.println(s);
        }

    }
}
